package wcg;

import java.io.File;
import java.io.FilenameFilter;
import java.util.regex.Pattern;


public class FileNamePatternFilter implements FilenameFilter{
	   private Pattern namePattern_;

	    public FileNamePatternFilter(Pattern namePattern) {
	        if (namePattern == null) {
	            throw new NullPointerException();
	        }
	        namePattern_ = namePattern;
	    }

	    public boolean accept(File dir, String name) {
	        return namePattern_.matcher(name).matches();
	    }

}
